package com.example.ch8;

import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class RollDickServlet
 */
public class RollDickServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RollDickServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String num = "2";
		request.setAttribute("num", num);
		Integer i = new Integer(3);
		request.setAttribute("integer", i);
		ArrayList list = new ArrayList();
		list.add("true");
		list.add("false");
		list.add("2");
		list.add("10");
		request.setAttribute("list", list);
		RequestDispatcher dispatcher = request.getRequestDispatcher("rollIt.jsp");
		dispatcher.forward(request, response);
	}

}
